<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('机构用户管理信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="formId">
				<div class="select-list">
					<ul>
						<li>
							<label>所在省市：</label>

							<select th:each="provinces : ${citys}" id="prvovinces" name="suProvince" onchange="provinceschange()">
								<option value="">--请选择--</option>
								<option  th:value="${provinces.cId}"  th:text="${provinces.cName}"></option>
							</select>

							<select th:each="provinces : ${citys}" id="city" name="suCity" onchange="citychange()">
								<option value="">--请选择--</option>
								<div  th:each="city : ${provinces.children}">
									<option style="display: none;" class="cc" th:classappend="${city.fId}" th:value="${city.cId}"  th:text="${city.cName}"></option>
								</div>
							</select>

							<select th:each="provinces : ${citys}" id="region" name="suArea">
								<option value="">--请选择--</option>
								<div  th:each="city : ${provinces.children}">
									<div th:each="region : ${city.children}">
										<option style="display: none;" class="rr" th:classappend="${region.fId}" th:value="${region.cId}"  th:text="${region.cName}"></option>
									</div>
								</div>

							</select>
						</li>
						<li>
							<label>机构用户姓名：</label>
							<input type="text" name="suName"/>
						</li>
						<li>
							<label>联系电话：</label>
							<input type="text" name="suPhone"/>
						</li>
						<li>
							<label>关注时间：</label>
							<input type="text" class="time-input" placeholder="请选择关注时间" name="time"/>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group-sm" id="toolbar" role="group">
<!--			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="itsystem:smalluser:add">-->
<!--				<i class="fa fa-plus"></i> 添加-->
<!--			</a>-->
<!--			<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="itsystem:institution:edit">-->
<!--				<i class="fa fa-edit"></i> 修改-->
<!--			</a>-->
<!--			<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="itsystem:institution:remove">-->
<!--				<i class="fa fa-remove"></i> 删除-->
<!--			</a>-->
			<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="itsystem:smalluser:export">
				<i class="fa fa-download"></i> 导出
			</a>
		</div>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var editFlag = [[${@permission.hasPermi('itsystem:smalluser:edit')}]];
	var removeFlag = [[${@permission.hasPermi('itsystem:smalluser:remove')}]];
	var prefix = ctx + "itsystem/smalluser";

	$(function() {
		var options = {
			url: prefix + "/list",
			createUrl: prefix + "/add",
			updateUrl: prefix + "/edit/{id}",
			removeUrl: prefix + "/remove/{id}",
			exportUrl: prefix + "/export",
			modalName: "入驻培训机构管理信息",
			columns: [{
				checkbox: true
			},
				{
					field: 'suId',
					title: '用户ID',
					visible: false
				},
				{
					field: 'suName',
					title: '小程序用户姓名',
				},
				{
					field: 'openId',
					title: '小程序openId'
				},
				{
					field: 'suPhone',
					title: '联系电话',
				},
				{
					field: 'suAge',
					title: '用户年龄',
				},
				{
					field: 'suGender',
					title: '用户性别',
				},
				{
					field: 'time',
					title: '关注时间',
				},
				{
					title: '操作',
					align: 'center',
					formatter: function(value, row, index) {
						var actions = [];
						//favicon.ico:1 Failed to load resource: the server responded with a status of 404 ()
						actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.suId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
						actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.suId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
					}
				}]
		};
		$.table.init(options);
	});


	function provinceschange() {
		var value = $("#prvovinces").val();
		$(".cc").hide();
		$(".rr").hide();

		$("#city").val("");
		$("#region").val("");
		$("." + value).show();

	}

	function citychange() {
		var value = $("#city").val();
		$(".rr").hide();
		$("#region").val("");
		$("." + value).show();
	}

</script>
</body>
</html>